package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidConsumerDao;
import com.chinasi.model.BidConsumer;
import com.chinasi.model.ConsumerBasic;
import com.chinasi.service.BidConsumerService;

@Service
public class BidConsumerServiceImpl implements BidConsumerService {

	/**
	 * BidConsumerDAO
	 */
	@Autowired
	private BidConsumerDao bidConsumerDao;
	
	@Override
	public Pager findRelationBid(String conCode, int currentPage) {
		BidConsumer searchBean = new BidConsumer();
		searchBean.setConCode(conCode);
		Pager pager = new Pager(bidConsumerDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidConsumerDao.findRelationBid(searchBean,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsult(ConsumerBasic consumer, int currentPage) {
		Pager pager = new Pager(bidConsumerDao.getRelationConsultTotalCount(consumer),currentPage);
		pager.setData(bidConsumerDao.findRelationConsult(consumer,pager));
		return pager;
	}

	@Override
	public Pager findRelationIntegrator(ConsumerBasic consumer, int currentPage) {
		Pager pager = new Pager(bidConsumerDao.getRelationIntegratorTotalCount(consumer),currentPage);
		pager.setData(bidConsumerDao.findRelationIntegrator(consumer,pager));
		return pager;
	}

	@Override
	public Pager findRelationAgency(ConsumerBasic consumer, int currentPage) {
		Pager pager = new Pager(bidConsumerDao.getRelationAgencyTotalCount(consumer),currentPage);
		pager.setData(bidConsumerDao.findRelationAgency(consumer,pager));
		return pager;
	}

	@Override
	public Pager findRelationSupervision(ConsumerBasic consumer, int currentPage) {
		Pager pager = new Pager(bidConsumerDao.getRelationSupervisionTotalCount(consumer),currentPage);
		pager.setData(bidConsumerDao.findRelationSupervision(consumer,pager));
		return pager;
	}

	@Override
	public Pager findRelationExpert(ConsumerBasic consumer, int currentPage) {
		Pager pager = new Pager(bidConsumerDao.getRelationExpertTotalCount(consumer),currentPage);
		pager.setData(bidConsumerDao.findRelationExpert(consumer,pager));
		return pager;
	}
}
